public class demo1 {
    public static void main(String[] args) {
        int x = 0;

        for(int i = 1; i <= 2019; ++i) {
            String string = i + "";
            char[] chars = string.toCharArray();

            for(int y = 0; y < chars.length; ++y) {
                if (chars[y] == '2' || chars[y] == '0' || chars[y] == '1' || chars[y] == '9') {
                    x += i;
                    break;
                }
            }
        }

        System.out.println(x);
    }
}
